Python 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> def isprime(a):
... 
...     for b in range(2,int(a**(1/2))+1):
... 
...         if a%b==0:
... 
...             return False
... 
...     return True
... 
... digits ={
... 
...     "zero":0,
... 
...     "one":1,
... 
...     "two":2,
... 
...     "three":3,
... 
...     "four":4,
... 
...     "five":5,
... 
...     "six":6,
... 
...     "seven":7,
... 
...     "eight":8,
... 
...     "nine":9,
... 
... }
... 
... n=input().split(" ")
... 
... r = ""

j=0

k=0

for i in n:

    if i in digits:

        r=r+str(digits[i])

    else:

        print("Wrong input")

        exit()

r = int(r)

for l in range(r, r*1000):

    if isprime(l):

        j=l

        break

for z in range(r,2,-1):

    if isprime(z):

        k=z

        break

if r-k>j-r:

    print(j)

else:

